package com.example.sentineldemo.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @Package: com.example.sentineldemo.service
 * @ClassName: AsyncService
 * @Author: Think
 * @CreateTime: 2021/7/23 10:21
 * @Description:
 */
@Slf4j
@Service
public class AsyncService {

    @Async
    public void asyncInvoke(){
        log.info("开始asyncInvoke。。。");
        try {
            // 沉睡10秒，模拟远程调用
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("结束asyncInvoke。。。");
    }

}
